﻿using ReactiveUI;
using System;
using System.Collections.Generic;
using System.Reactive.Disposables;
using System.Text;
using System.Windows.Input;

namespace RxWPF.Views
{
    public class MainViewer : ReactiveObject, IActivatableViewModel
    {
        public ViewModelActivator Activator { get; }
        public MainViewer()
        {
            Activator = new ViewModelActivator();
            this.WhenActivated((CompositeDisposable d) =>
            {
                this.Name = "defa";
            });

            MemoryCollectCommand = ReactiveCommand.Create(() =>
            {
            
                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();
             });
        }
        private string name;
        public string Name
        {
            get => name;
            set => this.RaiseAndSetIfChanged(ref name, value);
        }

        public ICommand MemoryCollectCommand { get; }
        
    }
}
